import Echo from 'laravel-echo'
import Pusher from 'pusher-js'

window.Pusher = require('pusher-js')

/**
 * pusher配置
 */

const pusherConfig = {
  forceTLS: false,
  wsHost: '36.138.146.89',
  wsPort: 6001,
  key: '985a57aee62562e2326b',
  cluster: 'ap3',
  secret: '17c6d1d1c3d9a5d8663a',
  disableStats: true,
}

class LaravelEcho {
  static instance = null

  constructor() {
    this.instance = new Echo({
      // client: new Pusher('key', pusherConfig),
      broadcaster: 'pusher',
      wsHost: '36.138.146.89',
      wsPort: 6001,
      cluster: 'ap3',
      secret: '17c6d1d1c3d9a5d8663a',
      key: '985a57aee62562e2326b',
      disableStats: true,
      encrypted: true,
      forceTLS: false
    })

  }
}

export default new LaravelEcho()
